package com.bw.base.net

import com.bw.base.entity.GoodsEntity
import com.bw.base.entity.IndexEntity
import com.bw.base.entity.LoginCodeEntity
import com.bw.base.entity.LoginEntity
import com.bw.base.entity.Res
import com.bw.base.entity.Res2
import com.bw.base.entity.SendCodeEntity
import com.bw.base.entity.UserEntity
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiServer {

    //发送验证码
    @POST(Cons.URL_SEND_CODE)
    suspend fun SendCode(@Query("phone")phone:String):Res<SendCodeEntity>


    @POST("/api/front/login/mobile")
    suspend fun LoginCode(@Body body: RequestBody):Res<LoginCodeEntity>

    @GET("/api/front/user")
    suspend fun User():Res<UserEntity>

    @POST("/api/front/register/reset")
    suspend fun Update(@Body body: RequestBody):Res2

    //账号密码登录
    @POST("/api/front/login")
    suspend fun Login(@Body body: RequestBody):Res<LoginEntity>

    @GET("/api/front/index")
    suspend fun Index():Res<IndexEntity>

    @GET("/api/front/index/product/{type}")
    suspend fun Goods(@Path("type")type:Int,@Query("limit")limit:Int,@Query("page")page:Int):Res<GoodsEntity>

}